import { GCellRenderer } from "../../../../../com/mui/controls/GCellRenderer";
import { ObjCreate } from "../../common/ObjCreate";
import { ImagesConst } from "../../../resource/ImagesConst";
import { GTextFormat } from "../../../../common/GTextFormat";
import { FontUtil } from "../../../../common/font/FontUtil";
import { Language } from "../../../../../extend/language/Language";
import { ObjectItem } from "../../treasure/ObjectItem";
import { LoaderHelp } from "../../../../common/display/LoaderHelp";
import { ResFileConst } from "../../../resource/ResFileConst";
import { GlobalClass } from "../../../../../com/mui/core/GlobalClass";
import { SNewLoginBackRewardInfo } from "../../../../../Message/Game/SNewLoginBackRewardInfo";
import { ItemData } from "../../../resource/info/ItemData";
import { GTextFiled } from "../../../../../com/mui/controls/GTextFiled";
//class CharmRewardRenderer
    
    export  class CharmRewardRenderer extends GCellRenderer
    {
        constructor()
        {
            super();
            return;
        }

        protected /* override */ configUI(): void
        {
            super.configUI();
            this._rankBmp = ObjCreate.createBitmap(null, 10, 5, this);
            this._rankBmp1 = ObjCreate.createBitmap(null, 160, 5, this);
            ObjCreate.createBg(5, 78, 230, 2, this, ImagesConst.SplitLine);
            var loc1=new GTextFormat(FontUtil.xingkaiName, 16, 6350622);
            this._charmTxt = ObjCreate.createGTextField("", 80, 5, 100, 30, this, loc1);
            ObjCreate.createGTextField(Language.getString(36290), 15, 40, 80, 20, this);
            this._objItem = new ObjectItem();
            this._objItem.setSize(32, 32);
            this._objItem.move(65, 30);
            addChild(this._objItem);
            LoaderHelp.addResCallBack(ResFileConst.InterFlowerRank, this.onResLoaded);
            return;
        }

        /* internal  */onResLoaded(): void
        {
            this._rankBmp.bitmapData = GlobalClass.getBitmapData(ImagesConst.CharmRank);
            this._rankBmp1.bitmapData = GlobalClass.getBitmapData(ImagesConst.CharmRank_1);
            this._charmTxt.x = this._rankBmp.x + this._rankBmp.width + 10;
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            super.data = arg1;
            if (arg1 && arg1 is SNewLoginBackRewardInfo) 
            {
                this._info = arg1 as SNewLoginBackRewardInfo;
                this._objItem.itemData = new ItemData(this._info.itemCode);
                this._objItem.amount = this._info.getFlag;
                this._charmTxt.text = this._info.pos + "";
            }
            return;
        }

        /* internal */ /* var */_rankBmp: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_rankBmp1: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_charmTxt: GTextFiled;

        /* internal */ /* var */_objItem: ObjectItem;

        /* internal */ /* var */_info: SNewLoginBackRewardInfo;
    }
